<?php

namespace App\Models\SystemManagement;

use App\Models\CommonModel;
use Illuminate\Database\Eloquent\Model;

class SkillJob extends CommonModel
{
    protected $table = 'skill_jobs';
    public $primaryKey = 'id';
    protected $guarded = [];

    protected $hidden = ['updated_at','created_at','deleted_at'];

    //查询list
    public function getList($request)
    {
    	$per_page = $request->input('per_page',10);
    	return self::orderBy('id','desc')
                ->with('skill')
                ->paginate($per_page);
    }

    //批量恢复
    public static function recover($ids){
        $query = self::withTrashed()
            ->whereIn('id',$ids)
            ->restore();
        return $query;
    }

    //所属职级
    public function skill()
    {
    	return $this->belongsTo(self::$SYSTEM.'\Skill','skill_id','id')->select('id','name');
    }

}
